import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';

import { ApiProperty } from "@nestjs/swagger";

@Entity({ name: 'order' })
export class OrderEntity {

    @PrimaryGeneratedColumn()
    @ApiProperty({ description: '' })
    id: number

    @Column()
    @ApiProperty({ description: '用户id' })
    userId: number

    @Column()
    @ApiProperty({ description: '订单号' })
    orderCode: string

    @Column()
    @ApiProperty({ description: '商品数量' })
    num: number

    @Column()
    @ApiProperty({ description: '商品总价' })
    totalPrice: number

    @Column()
    @ApiProperty({ description: '订单状态（0待付款 1取消 2待发货 3已发货 4运输中 5已完成）' })
    status: number

    @Column()
    @ApiProperty({ description: "配送单号" })
    deliveryCode: string

    @Column()
    @ApiProperty({ description: "配送地址" })
    deliveryAddress: string

    @CreateDateColumn()
    @ApiProperty({ description: '创建时间' })
    createdTime: Date

    @UpdateDateColumn()
    @ApiProperty({ description: '更新时间' })
    updatedTime: Date

    @Column()
    @ApiProperty({ description: "支付时间" })
    payTime: Date

    @Column()
    @ApiProperty({ description: "交易号" })
    tradeCode: string

    @Column()
    @ApiProperty({ description: "快递费" })
    deliveryFee: number

    @Column()
    @ApiProperty({ description: "实付款" })
    realPay: number

    @Column()
    @ApiProperty({ description: "发货时间" })
    deliveryTime: Date

}